<?php

class ReferencyBox extends AbstractBox {
	protected $template = 'reality/referency-box.tpl';

	/**
	 * @var	tslib_pibase
	 */
	protected $cObject = NULL;
	
	public function __construct($cObject) {
		$this->cObject = $cObject;
	}
	
	protected function setup() {
		$referencyRepository = new ReferencyRepository();
		$referencyRepository->addOrderBy(array('RAND()' => ''));
		$referency = $referencyRepository->getOneBy();
		if ($referency) {
			$referency['text'] = $this->cObject->pi_RTEcssText($referency['text']);
		}
		MySmarty::assign('referency', $referency);
	}
}

?>